package com.league.zjxn.main.popup

import android.content.Context
import android.view.Gravity
import android.view.View
import android.view.animation.Animation
import android.widget.ImageView
import com.league.zjxn.R
import razerdp.basepopup.BasePopupWindow
import razerdp.util.animation.AlphaConfig
import razerdp.util.animation.AnimationHelper

class ImageZoomPopup(
    context: Context
) : BasePopupWindow(context) {


    init {
        popupGravity = Gravity.CENTER
        setOverlayNavigationBar(false)
    }


    override fun onCreateContentView(): View {
        return createPopupById(R.layout.popup_image_zoom)
    }

    override fun onViewCreated(contentView: View) {
        super.onViewCreated(contentView)
        contentView.findViewById<ImageView>(R.id.ivImageZoomIcon).setOnClickListener {
            dismiss()
        }
    }

    override fun onCreateShowAnimation(): Animation {
        return AnimationHelper.asAnimation()
            .withAlpha(AlphaConfig.IN)
            .toShow()
    }

    override fun onCreateDismissAnimation(): Animation {
        return AnimationHelper.asAnimation()
            .withAlpha(AlphaConfig.OUT)
            .toDismiss()
    }

}